package com.fenyin.samples.study.jdk.nio;

import java.nio.ByteBuffer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.fenyin.samples.study.jdk.nio.buffer.ByteBufferTest;

public class NIOLogUtil {
	
	private static final Log log = LogFactory.getLog(ByteBufferTest.class);

	public static void print(String key, ByteBuffer buffer) {
		StringBuffer sb = new StringBuffer(key + ":");
		for(int i=0;i<buffer.limit();i++){
			byte b = buffer.get(i);
			sb.append(b).append("|");
		}
		sb.append(buffer.toString());
		log.info(sb.toString());
	}

	public static void print(String key) {
		log.info(key + ":");
	}

}
